<%--
  Created by IntelliJ IDEA.
  User: 1
  Date: 2022/1/13
  Time: 8:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.css">
    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
    <script src="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.js"></script>
</head>
<body>
<div class="container" id="div1">
    <caption>
        <div style="float: right;margin-bottom: 5px">
        </div>
    </caption>
    <table id="table" class="table table-hover">

    </table>
    <script>
        $(function () {
            $("#table").bootstrapTable({
                method:"get",
                contentType:"application/json",
                url:"http://localhost:8080/ck/querySG",
                striped:true,
                pageNumber:1,
                pagination:true,
                sidePagination:"server",
                pageSize:5,
                pageList:[3,5,7,10],
                queryParams:function (param) {
                    return {
                        page: (param.offset / param.limit) + 1,
                        pageNum: param.limit,
                        checkTag:"S001-1",
                    }
                },
                columns:[
                    {title:"入库单编号",field:"gatherId",align:"center"},
                    {title:"入库理由",field:"reason",align:"center"},
                    {title:"审核标志",field:"checkTag",align:"center"},
                    {title:"审核标志",field:"storeTag",align:"center"},
                    {title:"操作",field:"id",align:"center",formatter:function (value,row) {
                            var btn1="<button class='btn btn-primary btn-sm' data-toggle='modal' data-target='#myModal' onclick=update('"+row.gatherId+"','"+row.amountSum+"','"+row.costPriceSum+"','"+row.storeTag+"')>入库调度</button>";
                            return btn1
                        }}
                ]
            })
        })
    </script>
</div>

<DIV class=DIV_STYLE2 style="display: none" id="div2"><TABLE cellSpacing=0 cellPadding=0 width=1000 align=center bgColor=#ffffff border=0 >
    <div style="position: relative;left: 60%">

        <INPUT   onclick="tijiao()" type=button value=提交>
        <INPUT onmouseup="this.className='btn3_mouseup'" onclick=fanhui() onmouseover="this.className='btn3_mouseover'" onmousedown="this.className='btn3_mousedown'" onmouseout="this.className='btn3_mouseout'" class=btn3_mouseout type=button value=返回>
    </div>
    <TBODY>
    <TR>
        <TD class=TABLE_STYLE6 vAlign=bottom rowSpan=2 align=center>
            <TABLE style="BORDER-TOP: #333333 1px solid; BORDER-RIGHT: #333333 1px solid; BORDER-BOTTOM: #333333 1px solid; BORDER-LEFT: #333333 1px solid" cellSpacing=0 cellPadding=0 width="100%" border=0>
                <TBODY>
                <TR>
                    <TD height=10 colSpan=4>
                        <TABLE width="100%">
                            <TBODY>
                            <TR>
                                <TD>
                                    <table align="center">
                                        <tr>
                                            <td><h3>入库申请单</h3></td>
                                        </tr>
                                    </table>
                                    <br>
                                    <div>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span >入库人:<span><input type="text" style="border-bottom: 1px solid #000000;border-left: 0px;border-top: 0px;border-right: 0px;width: 40%;outline:none"></span></span>
                                        <span style="position: relative;left:50px;">入库理由: <select name="" id="rkly">
                                         <option value="R001-1">生产入库</option>
                                         <option value="R001-2">库存初始</option>
                                         <option value="R001-3">赠送</option>
                                         <option value="R001-4">内部归还</option>
                                         <option value="R001-5">其他归还</option>
                                     </select></span>
                                        <br>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span>是否退回: <select name="">
                                         <option value="">是</option>
                                         <option value="">否</option>
                                     </select></span>
                                        <span style="position: relative;left:350px;">回退时间:<span><input type="date" style="border-bottom: 1px solid #000000;border-left: 0px;border-top: 0px;border-right: 0px;width: 40%;outline:none" id="sj"></span></span>
                                    </div>
                                    <br>
                                    <TABLE id=tableOnlineEdit class=TABLE_STYLE5 borderColor=#000000 cellSpacing=0 cols=1 borderColorDark=#eeeeee cellPadding=0 align=center borderColorLight=#848284 border=1><THEAD>

                                    </THEAD>
                                        <TBODY></TBODY>
                                    </TABLE>
                                    <br>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <span>总件数:
                                         <span><input type="text" style="border-bottom: 1px solid #000000;border-left: 0px;border-top: 0px;border-right: 0px;width: 40%;outline:none" id="sum"></span></span>
                                    <span style="position: relative;left:50px;">总金额:<span><input type="text" style="border-bottom: 1px solid #000000;border-left: 0px;border-top: 0px;border-right: 0px;width: 40%;outline:none" id="je"></span></span>
                                    <br>
                                    <br>

                                    <div>
                                        <div>
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                            <span style="position: relative;top: -40px">备注:</span><textarea style="resize: none" rows=4 cols="100" ></textarea>
                                        </div>
                                    </div>
                                </TD></TR></TBODY></TABLE></TD></TR>
                <TR>
                    <TD width=56 colSpan=3 noWrap></TD></TR>
                <TR>
                    <TD height=100 colSpan=3 noWrap></TD>
                    <TD></TD></TR>
                <TR vAlign=bottom>
                    <TD colSpan=4 noWrap align=center></TD></TR></TD>
                <TR>
                    <TD colSpan=4 noWrap align=right></TD></TR></TBODY></TABLE></TD>
        <TD bgColor=#ffffff height=2 width=1></TD>
        <TD bgColor=#ffffff height=2 width=1></TD>
        <TD bgColor=#ffffff height=2 width=1></TD></TR>
    <TR>
        <TD bgColor=#333333 height=120 width=1></TD>
        <TD bgColor=#666666 height=120 width=1></TD>
        <TD bgColor=#999999 height=120 width=1></TD></TR>
    <TR align=right vAlign=top>
        <TD colSpan=4>
            <TABLE class=TABLE_STYLE6 cellSpacing=0 cellPadding=0 align=center border=0>
                <TBODY>
                <TR>
                    <TD bgColor=#333333 height=1></TD></TR>
                <TR>
                    <TD bgColor=#666666 height=1></TD></TR>
                <TR>
                    <TD bgColor=#999999 height=1></TD></TR></TBODY></TABLE></TD></TR>
    <TR align=right vAlign=middle>
        <TD colSpan=4></TD></TR></TBODY></TABLE></DIV>



<DIV class=DIV_STYLE2 style="display: none" id="div3"><TABLE cellSpacing=0 cellPadding=0 width=1000 align=center bgColor=#ffffff border=0 >
    <div style="position: relative;left: 60%">
        <INPUT   onclick="tj()" type=button value=提交>
        <INPUT   onclick="tc()" type=button value=退出>
        <INPUT onmouseup="this.className='btn3_mouseup'" onclick=fanhui() onmouseover="this.className='btn3_mouseover'" onmousedown="this.className='btn3_mousedown'" onmouseout="this.className='btn3_mouseout'" class=btn3_mouseout type=button value=返回>
    </div>
    <TBODY>
    <TR>
        <TD class=TABLE_STYLE6 vAlign=bottom rowSpan=2 align=center>
            <TABLE style="BORDER-TOP: #333333 1px solid; BORDER-RIGHT: #333333 1px solid; BORDER-BOTTOM: #333333 1px solid; BORDER-LEFT: #333333 1px solid" cellSpacing=0 cellPadding=0 width="100%" border=0>
                <TBODY>
                <TR>
                    <TD height=10 colSpan=4>
                        <TABLE width="100%">
                            <TBODY>
                            <TR>
                                <TD>
                                    <table align="center">
                                        <tr>
                                            <td><h3>入库申请单</h3></td>
                                        </tr>
                                    </table>
                                    <br>
                                    <div>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span >入库人:<span><input type="text" style="border-bottom: 1px solid #000000;border-left: 0px;border-top: 0px;border-right: 0px;width: 40%;outline:none"></span></span>
                                        <span style="position: relative;left:50px;">入库理由: <select name="" id="rkly2">
                                         <option value="R001-1">生产入库</option>
                                         <option value="R001-2">库存初始</option>
                                         <option value="R001-3">赠送</option>
                                         <option value="R001-4">内部归还</option>
                                         <option value="R001-5">其他归还</option>
                                     </select></span>
                                        <br>
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        <span>是否退回: <select name="">
                                         <option value="">是</option>
                                         <option value="">否</option>
                                     </select></span>
                                        <span style="position: relative;left:350px;">回退时间:<span><input type="date" style="border-bottom: 1px solid #000000;border-left: 0px;border-top: 0px;border-right: 0px;width: 40%;outline:none" id="sj2"></span></span>
                                    </div>
                                    <br>
                                    <TABLE id=tableOnlineEdit2 class=TABLE_STYLE5 borderColor=#000000 cellSpacing=0 cols=1 borderColorDark=#eeeeee cellPadding=0 align=center borderColorLight=#848284 border=1><THEAD>
                                    <TR class=TR_STYLE2 height="10" bgColor=#d2e9ff>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>产品名称</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>产品编号</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="7%" align=left>应入库件数</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>已入库件数</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>存放地址</TD>
                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>入库件数</TD>
                                    </TR>
                                    </THEAD>
                                        <TBODY></TBODY>
                                    </TABLE>
                                    <br>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <span>总件数:
                                         <span><input type="text" style="border-bottom: 1px solid #000000;border-left: 0px;border-top: 0px;border-right: 0px;width: 40%;outline:none" id="sum2"></span></span>
                                    <span style="position: relative;left:50px;">总金额:<span><input type="text" style="border-bottom: 1px solid #000000;border-left: 0px;border-top: 0px;border-right: 0px;width: 40%;outline:none" id="je2"></span></span>
                                    <br>
                                    <br>

                                    <div>
                                        <div>
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                            <span style="position: relative;top: -40px">备注:</span><textarea style="resize: none" rows=4 cols="100" ></textarea>
                                        </div>
                                    </div>
                                </TD></TR></TBODY></TABLE></TD></TR>
                <TR>
                    <TD width=56 colSpan=3 noWrap></TD></TR>
                <TR>
                    <TD height=100 colSpan=3 noWrap></TD>
                    <TD></TD></TR>
                <TR vAlign=bottom>
                    <TD colSpan=4 noWrap align=center></TD></TR></TD>
                <TR>
                    <TD colSpan=4 noWrap align=right></TD></TR></TBODY></TABLE></TD>
        <TD bgColor=#ffffff height=2 width=1></TD>
        <TD bgColor=#ffffff height=2 width=1></TD>
        <TD bgColor=#ffffff height=2 width=1></TD></TR>
    <TR>
        <TD bgColor=#333333 height=120 width=1></TD>
        <TD bgColor=#666666 height=120 width=1></TD>
        <TD bgColor=#999999 height=120 width=1></TD></TR>
    <TR align=right vAlign=top>
        <TD colSpan=4>
            <TABLE class=TABLE_STYLE6 cellSpacing=0 cellPadding=0 align=center border=0>
                <TBODY>
                <TR>
                    <TD bgColor=#333333 height=1></TD></TR>
                <TR>
                    <TD bgColor=#666666 height=1></TD></TR>
                <TR>
                    <TD bgColor=#999999 height=1></TD></TR></TBODY></TABLE></TD></TR>
    <TR align=right vAlign=middle>
        <TD colSpan=4></TD></TR></TBODY></TABLE></DIV>
<script>
    let id;
    function update(aa,bb,cc,dd){
        if(dd=='K002-1') {
            document.getElementById("div1").style.display = "none";
            document.getElementById("div2").style.display = "block";
            id = aa;
            $("#sum").val(bb);
            $("#je").val(cc);
            $("#tableOnlineEdit").bootstrapTable({
                method: "get",
                contentType: "application/json",
                url: "http://localhost:8080/ck/querySGD",
                striped: true,
                pageNumber: 1,
                pagination: true,
                sidePagination: "server",
                pageSize: 5,
                pageList: [3, 5, 7, 10],
                queryParams: function (param) {
                    return {
                        page: (param.offset / param.limit) + 1,
                        pageNum: param.limit,
                        parentId: aa
                    }
                },
                columns: [
                    {title: "产品编号", field: "productId", align: "center"},
                    {title: "产品名称", field: "productName", align: "center"},
                    {title: "应入库件数", field: "amount", align: "center"},
                    {title: "已入库件数", field: "", align: "center"},
                    {title: "存放地址", field: "", align: "center"},
                    {
                        title: "操作", field: "id", align: "center", formatter: function (value, row) {
                            var btn1 = "<button  onclick=update2('" + row.productId + "','" + row.productName + "','" + row.amount + "') id='" + row.productId + "'>调度</button>";

                            return btn1
                        }
                    }
                ]
            })
        }
    }
    function update2(aa,bb,cc) {
            document.getElementById("div3").style.display="block";
            document.getElementById("div2").style.display="none";

            document.getElementById("tableOnlineEdit2").innerHTML+=" <TR class=TR_STYLE2 height=\"10\" bgColor=#d2e9ff>\n" +
                "                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width=\"13%\" align=left id='id'>"+aa+"</TD>\n" +
                "                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width=\"13%\" align=left>"+bb+"</TD>\n" +
                "                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width=\"7%\" align=left>"+cc+"</TD>\n" +
                "                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width=\"11%\" align=left></TD>\n" +
                "                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width=\"11%\" align=left></TD>\n" +
                "                                        <TD class=TD_STYLE2 borderColor=#dedbd6 width=\"13%\" align=left><input type='text' id='rks'></TD>\n" +
                "                                    </TR>";
    }
    function tc() {
        document.getElementById("div2").style.display="block";
        document.getElementById("div3").style.display="none";
    }
    function tj() {
        let productId=$("#id").text();
        console.log(productId)
        let gatheredAmount = $("#rks").val();
        console.log(gatheredAmount)
        $.getJSON("http://localhost:8080/ck/updaterks",{productId:productId,gatheredAmount:gatheredAmount,gatherTag:"K002-2"},function (date) {
            console.log(date)
            if(date>=1){
                document.getElementById(productId).style.display="none";
                document.getElementById("b"+productId).style.display="block";
            }
        })
    }
    function tijiao() {
        $.getJSON("http://localhost:8080/ck/selectPdid",{parentId:id,gatherTag:"K002-1"},function (date) {
            if(date>0){
                window.location="/wp/rkdd.jsp";
            }else {
                alert("失败")
            }
        })
    }
</script>
</body>
</html>
